package com.linkhouse.controller;

import com.linkhouse.common.domain.Result;
import com.linkhouse.domain.bo.TbOldRoomBO;
import com.linkhouse.domain.dto.TbOldRoomDTO;
import com.linkhouse.service.TbOldRoomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("tbOldRoom")
@Api("二手房")
public class TbOldRoomController {

    @Autowired
    private TbOldRoomService tbOldRoomService;



    @PostMapping
    @ApiOperation("二手房源增加")
    @ApiImplicitParam(name = "tbOldRoomDTO", value = "二手房源实体",required = true,paramType = "body")
    public Result insert(@RequestBody TbOldRoomDTO tbOldRoomDTO){
        TbOldRoomBO tbOldRoomBO = new TbOldRoomBO();
        BeanUtils.copyProperties(tbOldRoomDTO,tbOldRoomBO);
        Integer i = tbOldRoomService.insert(tbOldRoomBO);
        return Result.ok().setData(i);
    }

}

